package com.fosu.web.controller;

import com.fosu.common.ResponseResult;
import com.fosu.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * @author 郭俊求
 * @date 2020/11/9
 */
@RestController
@CrossOrigin
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    
    @GetMapping("/getAllRole")
    public ResponseResult getAllRole(HttpServletResponse resp){
        return roleService.findAll(resp);
    }

    @GetMapping("/getRoleById")
    public ResponseResult getAllUser(@RequestParam("userId") int userId, HttpServletResponse resp) {
        return roleService.findUserAndRoleById(resp,userId);
    }

}
